package cn.tedu.test01;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//如何交给Spring来进行对象的创建和对象的管理
//@Component 声明组件类，将其交给Spring
@Component
public class User {


    private Phone phone;

    public User(Phone phone){
        System.out.println("User对象被创建了");
        this.phone=phone;
    }

    public void play(){
        System.out.println("传奇老师上课偷偷用"+phone.getName()+"打游戏");
    }
}
